<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Choice</title>
</head>
<body>
<form action="">
    <p><input type="checkbox" name="" >歼二零隐形歼击机</p>
    <p><input type="checkbox" name="" >歼十六重型战斗机</p>
    <p><input type="checkbox" name="" >歼十C多用途战斗机</p>
    <p><input type="checkbox" name="" >歼十五飞鲨舰载机</p>
</form>
<button >全选</button>
<button >全不选</button>
<button >反选</button>

<script>
    let bts = document.getElementsByTagName("button");
    let inputs = document.getElementsByTagName("input");
    
    bts[0].onclick=function () {
        for (var i = 0; i < inputs.length; i++) {
            inputs[i].checked=true;
        }
    }

    bts[1].onclick=function () {
        for (var i = 0; i < inputs.length; i++) {
            inputs[i].checked=false;
        }
    }

    bts[2].onclick=function () {
        for (var i = 0; i < inputs.length; i++) {
            if (inputs[i].checked) {
                inputs[i].checked=false;
            }else {
                inputs[i].checked=true;
            }
        }
    }
</script>
</body>
</html>